Micron Document
🎖️GitЯра🎖️


Displaying Rendered • View rawDownload

.skills/implement-feature/SKILL.md 5235b8fc51eb5f46d453effb2deec00bcc6abdbb (5235b8fc) Text, 2.31 KB

Skill: Implement a Feature

Description
A step-by-step workflow for implementing a new feature in the Meshtastic-Android codebase, ensuring KMP compatibility and proper architecture.

Workflow

1. Update Dependencies & Aliases
• Check T383838gradle/libs.versions.toml before adding libraries.
• Use T383838jetbrains-* aliases for lifecycle/navigation/adaptive dependencies in T383838commonMain.
• Use T383838compose-multiplatform-* aliases for CMP dependencies.

2. Define the State & ViewModels
• Follow MVI/UDF patterns.
• Extend shared ViewModel logic in T383838feature/<name>/src/commonMain/kotlin/org/meshtastic/feature/<name>/<Name>ViewModel.kt.
• Use T383838stateInWhileSubscribed (from T383838core:ui) for sharing state flows.
• Keep the ViewModel free of Android framework dependencies.

3. Build the UI
• Use Jetpack Compose Multiplatform (CMP).
• Define strings in T383838core:resources (see the T383838compose-ui skill).
• Support adaptive layouts (Large/XL breakpoints).

4. Wire Navigation & DI
• Define typed route objects in T383838core:navigation.
• Export the navigation graph as an extension function on T383838EntryProviderScope<NavKey> in T383838commonMain (e.g., T383838fun EntryProviderScope<NavKey>.myFeatureGraph()).
• Add the required DI bindings via Koin Annotations (T383838@Factory, T383838@Single, T383838@KoinViewModel) in T383838commonMain.
CRITICAL: Ensure the module is registered in the app root graphs (T383838AppKoinModule.kt, T383838DesktopKoinModule.kt) and the navigation is injected into the root entry provider in the host shell.

5. Validate Platform Separation
• If you need a platform-specific API (like camera or specific mapping SDK), define an interface in T383838commonMain, implement it in the host shell, and inject it via T383838CompositionLocal or Koin.

6. Verify Locally
• Run the baseline checks (see T383838testing-ci skill):
T282828
./gradlew spotlessApply spotlessCheck detekt assembleDebug Tffa657test allTests

• Add T383838kmpSmokeCompile to the command when the feature touches a KMP module (most features do) so cross-target compile failures surface before merge.
• If the feature adds a new reflection-heavy dependency, add keep rules to both T383838androidApp/proguard-rules.pro and T383838desktopApp/proguard-rules.pro, then verify release builds:
T282828
./gradlew assembleFdroidRelease :desktopApp:runRelease

Served by rngit 1.5.2 - Generated in 0.05s